import 'package:flutter/material.dart';
import './common/Global.dart';
import './routes/routes.dart';
import 'common/utils.dart';

const String appScheme = 'flutterChannelDemo';
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
void main() {
  // 初始化插件前需调用初始化代码 runApp()函数之前
  WidgetsFlutterBinding.ensureInitialized();
  // runApp(const MyApp());
  Global.init().then((value) => runApp(const MyApp()));
}

// class MyApp extends StatelessWidget {
//   const MyApp({super.key});

//   // This widget is the root of your application.
//   @override
//   Widget build(BuildContext context) {
//     bool _initialURILinkHandled = false;
//     return MaterialApp(
//       title: '曲稻劳务派遣系统',
//       theme: ThemeData(
//           primarySwatch: Colors.blue,
//           appBarTheme: const AppBarTheme(
//             centerTitle: true,
//           )),
//       initialRoute: "/",
//       onGenerateRoute: onGenerateRoute,
//     );
//   }
// }

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorObservers: [CustomNavigatorObserver()],
      title: '曲稻劳务派遣系统',
      theme: ThemeData(
          primarySwatch: Colors.blue,
          buttonTheme: const ButtonThemeData(buttonColor: Color(0xff334154)),
          // elevatedButtonTheme: const ElevatedButtonThemeData(
          //     style: ButtonStyle(
          //         backgroundColor:
          //             MaterialStatePropertyAll(Color(0xff334154)))),
          elevatedButtonTheme: ElevatedButtonThemeData(
              style: ButtonStyle(
                  backgroundColor:
                      MaterialStateProperty.all(const Color(0xff334154)))),
          appBarTheme:
              const AppBarTheme(centerTitle: true, color: Color(0xff334154))),
      initialRoute: "/",
      onGenerateRoute: onGenerateRoute,
    );
    ;
  }
}
